import os
import pytest
from selenium import webdriver
@pytest.fixture(scope='function')
def getdriver():
    driver =None
    print("得到的浏览器类型:",os.getenv('browertype'))
    #匹配浏览器
    if 'edge' == os.getenv('browertype'):
        driver = webdriver.Edge()
    elif 'chrome' == os.getenv('browertype'):
        driver = webdriver.Chrome()
    elif 'firefox' == os.getenv('browertype'):
        driver = webdriver.Firefox()

    if driver is None:
        print("未匹配到任何浏览器")
    #
    driver.maximize_window()
    driver.implicitly_wait(6)
    yield driver
    #清理测试资源
    driver.quit()


@pytest.fixture(scope='function')
def driver ():
    driver = webdriver.Edge()
    driver .maximize_window()
    driver .implicitly_wait(10)
    return driver